import React, { Component } from 'react'

export default class List extends Component {
    render() {
        const {list} = this.props
        return (
            <div>
                <h2>{list.length}</h2>
                <ul>
                    {list.map((val, index) => <li key={val.time}>
                        <input type="checkbox" />
                        {val.title}
                        ---
                        {val.time}
                        <button onClick={() => this.props.delIteml(index)}>delete</button>
                        {/* 放入事件处理函数 */}
                        {/* <button onClick={() => delToDo(index)}>delete</button> */}
                        {/* <button onClick={this.props.del(index)}>delete-2</button> */}

                    </li>)}
                </ul>
            </div>
        )
    }
}
